#ifndef _FUNCTIONLIST_H_
#define _FUNCTIONLIST_H_

#include <utillib/stl/map.h>

#define	FUNCTION_NAME_LENGTH		64

#define INSERT_USERFUNCTION( x, y )		insertUserFunction( ( void *)x, ( UserFunction )&y )
#define ADD_USERFUNCTION( x, y )		addUserFunction( x, ( UserFunction )&y )

namespace utillib
{
	namespace util
	{
		class UserFunctionManager
		{
		public:
			typedef void ( UserFunctionManager::*UserFunction )();
			typedef std::map < void *, UserFunction > mapFunction;

			struct FunctionProperty
			{
				char name[ FUNCTION_NAME_LENGTH + 1];
				UserFunction function;
			};
		public:
			UserFunctionManager();
			virtual ~UserFunctionManager();

			void matchUserFunction( char *name, void *key );
			UserFunction getUserFunction( void *key );
			bool insertUserFunction( void *key, UserFunction func );
		protected:
			void addUserFunction( char *name, UserFunction func );
			mapFunction m_functionList;

			utillib::stl::MapWithString < FunctionProperty * > m_functionNameList;
		};
	};
};

#endif